﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

namespace M
{
    public class Message
    {
        public static void ShowError(string text)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page == null) return;

            if (page.Master is HCFramework.Master.Admin.Admin)
            {
                HCFramework.Master.Admin.Admin master = (HCFramework.Master.Admin.Admin)page.Master;
                master.Message1.ShowError(text);
            }
            if (page.Master is HCFramework.Master.Normal.Normal)
            {
                HCFramework.Master.Normal.Normal master = (HCFramework.Master.Normal.Normal)page.Master;
                master.Message1.ShowError(text);
            }
        }
        public static void ShowErrorAndPreventAutoClear(string text)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page == null) return;

            if (page.Master is HCFramework.Master.Admin.Admin)
            {
                HCFramework.Master.Admin.Admin master = (HCFramework.Master.Admin.Admin)page.Master;
                master.Message1.ShowErrorAndPreventAutoClear(text);
            }
            if (page.Master is HCFramework.Master.Normal.Normal)
            {
                HCFramework.Master.Normal.Normal master = (HCFramework.Master.Normal.Normal)page.Master;
                master.Message1.ShowErrorAndPreventAutoClear(text);
            }
        }
        public static void ShowSuccess(string text)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page == null) return;

            if (page.Master is HCFramework.Master.Admin.Admin)
            {
                HCFramework.Master.Admin.Admin master = (HCFramework.Master.Admin.Admin)page.Master;
                master.Message1.ShowSuccess(text);
            }
            if (page.Master is HCFramework.Master.Normal.Normal)
            {
                HCFramework.Master.Normal.Normal master = (HCFramework.Master.Normal.Normal)page.Master;
                master.Message1.ShowSuccess(M.Common.GetLang(text));
            }
        }
        public static void ShowSuccessAndPreventAutoClear(string text)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page == null) return;

            if (page.Master is HCFramework.Master.Admin.Admin)
            {
                HCFramework.Master.Admin.Admin master = (HCFramework.Master.Admin.Admin)page.Master;
                master.Message1.ShowSuccessAndPreventAutoClear(text);
            }
            if (page.Master is HCFramework.Master.Normal.Normal)
            {
                HCFramework.Master.Normal.Normal master = (HCFramework.Master.Normal.Normal)page.Master;
                master.Message1.ShowSuccessAndPreventAutoClear(M.Common.GetLang(text));
            }
        }
        public static void ShowNormal(string text)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page == null) return;

            if (page.Master is HCFramework.Master.Admin.Admin)
            {
                HCFramework.Master.Admin.Admin master = (HCFramework.Master.Admin.Admin)page.Master;
                master.Message1.ShowNormal(text);
            }
            if (page.Master is HCFramework.Master.Normal.Normal)
            {
                HCFramework.Master.Normal.Normal master = (HCFramework.Master.Normal.Normal)page.Master;
                master.Message1.ShowNormal(text);
            }
        }
        public static void ShowNormalAndPreventAutoClear(string text)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page == null) return;

            if (page.Master is HCFramework.Master.Admin.Admin)
            {
                HCFramework.Master.Admin.Admin master = (HCFramework.Master.Admin.Admin)page.Master;
                master.Message1.ShowNormalAndPreventAutoClear(text);
            }
            if (page.Master is HCFramework.Master.Normal.Normal)
            {
                HCFramework.Master.Normal.Normal master = (HCFramework.Master.Normal.Normal)page.Master;
                master.Message1.ShowNormalAndPreventAutoClear(text);
            }
        }
    }
}